<?php
require_once ('HTML/QuickForm/Rule.php');
/**
 * QuickForm rule to check CSRF token
 */
class HTML_QuickForm_Rule_CSRF extends HTML_QuickForm_Rule
{
	function validate($token)
	{
        global $_user;
        $valid_token = Database::get_csrf_token($_user['user_id']);
        return $token == $valid_token;
	}
}
?>

